home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1991 / Jan 91 / MacApp.Tech$ 1⁄4⁄91 / 2578-Re ? Implementing OK-Jan91 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.9 KB  |  52 lines  |  [TEXT/GEOL]

  1. Item    2885047                         3-Jan-91        10:41PST
  2.  
  3. From:   PERRY.G                         Gregg, Perry
  4.  
  5. To:     PHIL.TH                         Thompson, Phil
  6.         CATHERS                         Cathers, Jeff
  7.         PIRO                            Paoletti, Giovanni
  8.         MACAPP.TECH$                    MacApp Technical
  9.  
  10. cc:     JERNIGAN1                       Jernigan, Ginger
  11.  
  12. ------------------------------------------------------------------------------
  13.  
  14. Sub:    Re: ? Implementing OK Button
  15.  
  16. Mike,
  17.  
  18. One of the original design themes of MacApp was that those class methods that
  19. start with Do…, like DoChoice are methods we mere mortal hackers may be
  20. interested in OVERRIDE-ing.  So always search for an easy way to do it in a Do…
  21. something method first.
  22.  
  23. So you could do something like the following in TYourDialogView.DoChoice:
  24.  
  25.    mButtonHit: { This handles clicking in 'OK' or 'Cancel'
  26.     buttons }
  27.    BEGIN
  28.    IF origView.fIdentifier = fDefaultItem THEN
  29.    BEGIN
  30.     {... Do your dialogs main purpose here, or create a command to do it.}
  31.    GetWindow.Close;
  32.    END
  33.    ELSE IF origView.fIdentifier = fCancelItem THEN
  34.    GetWindow.Close;
  35.  
  36. TChoiceButton would be overkill.  Generally, you only want to design classes
  37. for things MacApp doesn't do for you.  MacApp handles almost everthing
  38. regarding displaying a button in a dialog and choosing it.  It doesn't however
  39. do the work your app thinks the dialog should do.  So your class if any for
  40. choosing buttons might be related to and modelled after the action you want
  41. done (TWorkIDoWhenThisButtonHitCommand, etc.).  You would instantiate the
  42. command at the comment above under the fDefaultItem case.
  43.  
  44. Of course, there is no right way to do the things you want your app to do.  The
  45. above is just a path of small resistance.
  46.  
  47. -- Perry
  48.  
  49. P.S. You could override DismissDialog and check the dismisser.  This method
  50. could have been named DoDismissDialog.
  51.  
  52.